package com.xmall.mapper;

import com.xmall.bean.table.Order;
import com.xmall.bean.table.OrderExample;
import com.xmall.bean.vo.RowsGoodsVO;
import com.xmall.bean.vo.RowsOrderVO;
import com.xmall.bean.vo.WxIndexOrderStatusCount;
import com.xmall.bean.vo.WxIndexOrderStatusVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface OrderMapper {
    long countByExample(OrderExample example);

    int deleteByExample(OrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Order record);

    int insertSelective(Order record);

    List<Order> selectByExample(OrderExample example);

    Order selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    /**
     * 按时间分组查询商品统计数据
     * @return day ,orders,amount
     */
    List<RowsGoodsVO> queryGoodsDataByAddTime();

    /**
     * 按时间分组查询订单统计数据
     * @return
     */
    List<RowsOrderVO> queryOrderData();

    List<WxIndexOrderStatusCount> queryOrderStatusCountByUserId(@Param("userId") Integer userId);

    int countByUserIdAndStatusId(@Param("userId") Integer userId, @Param("statusId") int statusId);

}